home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 159 / 159.d81 / b.crypto results (.txt) < prev    next >
Commodore BASIC  |  2022-08-26  |  16KB  |  386 lines

  1. 10 rem solving knees calhoon's crypto challenge from loadstar 156
  2. 20 rem tom lawless / 229 dogwood lane / maynardville, tn 37807 / june 1997
  3. 30 poke53771,0:rem 20mhz if supercpu
  4. 40 c$=chr$(147):h$=chr$(19):b$=chr$(31):r$=chr$(28):o$=chr$(18):f$=chr$(146)
  5. 50 d$=chr$(17):u$=chr$(145):l$=chr$(157):i$=chr$(29):a$="":j$="":z$=""
  6. 60 g$=r$+"[184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184]"+b$:e$=r$+"[185][185][185][185][185][185][185][185][185][185][185][185][185][185][185][185][185][185][185]"+b$
  7. 70 m$="-------------------":s$=o$+"                   "
  8. 80 n$="-----------   ----------   -----------":print c$chr$(14);
  9. 90 poke 53280,15:poke 53281,15:d=230:dim c(39):for k=1 to 39:c(k)=-1:next
  10. 100 dim i(d),n(d),o(d),t(d),w(d),l(d),v(d),f(d),s(d),x(d),g(d),h(d),r(d),u(d)
  11. 110 :
  12. 120 print r$"[184]"g$g$,b$" 1. [207]+[206]+[197] = 1        [211][207][204][214][201][206][199]"
  13. 130 print m$"  [203][206][197][197][211][160][195][193][204][200][207][207][206]'[211]"
  14. 140 print" 2. [212]+[215]+[207] = 2        [195][210][217][208][212][207][160][195][200][193][204][204][197][206][199][197]",m$i$e$
  15. 150 print" 3. [212]+[200]+[210]+[197]+[197] = 3   "s$,f$m$i$o$" [211]olve this system "
  16. 160 print" 4. [198]+[207]+[213]+[210] = 4     "s$,f$m$i$o$" of equations over "
  17. 170 print" 5. [198]+[201]+[214]+[197] = 5     "s$,f$m$i$o$" the integers from "
  18. 180 print" 6. [211]+[201]+[216] = 6       "s$,f$m$i$o$" -19 to 19, inclu- "
  19. 190 print" 7. [211]+[197]+[214]+[197]+[206] = 7   "s$,f$m$i$o$" sive, with no two "
  20. 200 print" 8. [197]+[201]+[199]+[200]+[212] = 8   "s$,f$m$i$o$" variables having  "
  21. 210 print" 9. [206]+[201]+[206]+[197] = 9     "s$,f$m$i$o$" the same value.   "
  22. 220 print"10. [212]+[197]+[206] = 10      "s$,f$m$i$g$
  23. 230 print"11. [197]+[204]+[197]+[214]+[197]+[206] = 11  "r$"<[195]> [195]ontinue"b$
  24. 240 print m$"-  "r$"<[208]> [208]rint"b$
  25. 250 print"12. [212]+[215]+[197]+[204]+[214]+[197] = 12  "r$"<[212]> [212]ab 40 [208]rint"b$
  26. 260 print e$r$"[185]  <[209]> [209]uit"b$h$:gosub 5000
  27. 270 :
  28. 490 rem method
  29. 500 print c$tab(17)"[205][197][212][200][207][196]":print i$e$e$,i$s$s$,i$;
  30. 510 print" 1. [211]elect value of [197]. ([213]ser input)   ",i$s$s$,i$;
  31. 520 print" 2. [212][193][194][204][197] 1: 1 row for each [201] value.  ",i$;
  32. 530 print"    [197]valuate [206],[207],[212],[215] on each row.     ",i$;
  33. 540 print"    [196]iscard rows w/forbidden values.  ",i$s$s$,i$;
  34. 550 print" 3. [212][193][194][204][197] 2: [213]se all [204] values with    ",i$;
  35. 560 print"    each row of [212][193][194][204][197] 1. [197]valuate     ",i$;
  36. 570 print"    [214],[198],[211],[216]. [196]iscard rows as before.  ",i$s$s$,i$;
  37. 580 print" 4. [212][193][194][204][197] 3: [213]se all [199] values with    ",i$;
  38. 590 print"    each row of [212][193][194][204][197] 2. [197]valuate     ",i$;
  39. 600 print"    [200],[210],[213]. [196]iscard rows as before.    ",i$s$s$,i$;
  40. 610 print" 5. [196]isplay solutions. [210]eturn to 1.   ",i$s$s$,i$f$g$g$
  41. 620 print" [197] ="e;tab(8)"<"r$"+"b$"/"r$"-"b$">[211]elect [207]ne [197] [214]alue   <"r$"[200]"b$">"
  42. 630 print" <"r$"\"b$">[211]olve--[212]his [197]--[215]ork [211]creens   [200]elp"
  43. 640 print" <"r$"^"b$">[211]olve--[212]his [197]--[199]auge [211]creen   -----"
  44. 650 print" <"r$"*"b$">[211]olve--[193]ll [197]'s-[199]auge [211]creen   <[208]/[212]>"
  45. 660 print" <"r$"_"b$">[193]ssume [211]ummary [196]ata--[212]his [197]   <[209]>"u$u$u$u$
  46. 670 poke 650,128
  47. 680 get q$:if q$="q" then 40000
  48. 690 if q$="p"or q$="t"then gosub 9000:goto 680
  49. 695 if q$="h" then gosub 4000:goto 500
  50. 700 if q$="\"then c=0:goto 830
  51. 710 if q$="^"then c=-1:goto 830
  52. 720 if q$="*"then c=1:e=-19:goto 830
  53. 730 if q$<>"_" then 790
  54. 740 poke 53280,3:poke 53281,3
  55. 750 for k=1 to e+20:read z:next:restore
  56. 760 c=0:goto 2200
  57. 770 data 0,0,0,0,0,0,6,22,40,77,51,125,125,151,199,226,103,139,199,142
  58. 780 data 160,92,182,0,122,57,82,125,109,75,63,69,33,18,8,7,1,0,0
  59. 790 if q$<>"+"and q$<>"-"then 680
  60. 800 if q$="+"then e=e+1:if e=20 then e=-19
  61. 810 if q$="-"then e=e-1:if e=-20 then e=19
  62. 820 print tab(4)u$"   "l$l$l$e;b$:goto 680
  63. 830 poke 650,0:if c=0 then 940
  64. 840 if c=-1 then 930
  65. 850 :
  66. 890 rem table 1
  67. 900 if c(e+20)=-1 then 930
  68. 910 if e=19 then poke 53280,7:poke 53281,7:goto 2200
  69. 920 e=e+1:goto 900
  70. 930 print c$d$d$r$tab(9)"[197] ="e,,,d$b$"[212][193][194][204][197] 1: "r$"[201]  [206]  [207]  [212]  [215]"b$:goto 1060
  71. 940 print c$;:gosub 3030
  72. 950 print" 1. [207]+[206] ="1-e:print" 2. [212]+[215]+[207] = 2":print" 3. [212]+[200]+[210] ="3-2*e
  73. 960 print" 4. [198]+[207]+[213]+[210] = 4":print" 5. [198]+[201]+[214] ="5-e:print" 6. [211]+[201]+[216] = 6"
  74. 970 print" 7. [211]+[214]+[206] ="7-2*e:print" 8. [201]+[199]+[200]+[212] ="8-e:print" 9. 2[206]+[201] ="9-e
  75. 980 print"10. [212]+[206] ="10-e:print"11. [204]+[214]+[206] ="11-3*e:print m$l$" "
  76. 990 print" 9. [206] =("9-e"-[201])/2":print" 1. [207] ="1-e"-[206]"
  77. 1000 print"10. [212] ="10-e"-[206]":print" 2. [215] = 2-[212]-[207]"
  78. 1010 print e$l$" ":print o$"[201] _ [206] _ [207] & [212] _ [215] "
  79. 1020 print o$"[213]se all [201] values: ",,,"-19 < = [201] < = +19 ":print g$l$" "
  80. 1030 print h$tab(19)r$"[185][185][185] [185][185][185] [185][185][185] [185][185][185] [185][185][185]"b$,tab(19)
  81. 1040 print o$" [201] "i$" [206] "i$" [207] "i$" [212] "i$" [215] ",tab(19)
  82. 1050 print f$r$"[184][184][184] [184][184][184] [184][184][184] [184][184][184] [184][184][184]"b$,tab(20)"/   /   /   /   /"u$
  83. 1060 z=0:for i=-19 to 19
  84. 1070 n=(9-e-i)/2:if n<-19 or n>19 or n=i or n=e or n<>int(n) then 1120
  85. 1080 o=1-e-n:if o<-19 or o>19 or o=n or o=i or o=e then 1120
  86. 1090 t=10-e-n:if t<-19 or t>19 or t=n or t=i or t=e then 1120
  87. 1100 w=2-t-o:if w<-19 or w>19 or w=n or w=i or w=e then 1120
  88. 1110 z=z+1:i(z)=i:n(z)=n:o(z)=o:t(z)=t:w(z)=w
  89. 1120 next
  90. 1130 if c<>0 then 1200
  91. 1140 for k=1 to z:print tab(19)i(k)tab(23)n(k)tab(27)o(k)tab(31)t(k)tab(35)w(k)
  92. 1150 next:print tab(19)m$,tab(19)"[212][193][194][204][197] 1: [193]ll rows"
  93. 1160 print tab(19)"with invalid values",tab(19)"have been discarded"
  94. 1170 print tab(19)m$,tab(25)"<[195]> <[208]/[212]> <[209]>":gosub 5000
  95. 1180 :
  96. 1190 rem table 2
  97. 1200 a=1:j=1:if c=0 then 1230
  98. 1210 print d$"[212][193][194][204][197] 2: "r$"[204]  [214]  [198]  [211]  [216]"b$:for k=1to z:print".";:next:print u$
  99. 1220 print"[162]";:goto 1250
  100. 1230 gosub 2990:gosub 3020:print tab(21)u$"/   /   /   /   /"
  101. 1240 gosub 3030:gosub 3040
  102. 1250 k=j-1:forl=-19to19:ifl=w(j)orl=t(j)orl=o(j)orl=n(j)orl=i(j)or l=e then1350
  103. 1260 v=11-3*e-n(j)-l:if v<-19 or v>19 or v=l or v=e then 1350
  104. 1270 if v=w(j) or v=t(j) or v=o(j) or v=n(j) or v=i(j) then 1350
  105. 1280 f=5-e-i(j)-v:if f<-19 or f>19 or f=v or f=l or f=e then 1350
  106. 1290 if f=w(j) or f=t(j) or f=o(j) or f=n(j) or f=i(j) then 1350
  107. 1300 s=7-2*e-n(j)-v:if s<-19 or s>19 or s=f or s=v or s=l or s=e then 1350
  108. 1310 if s=w(j) or s=t(j) or s=o(j) or s=n(j) or s=i(j) then 1350
  109. 1320 x=6-i(j)-s:if x<-19 or x>19 or x=s or x=f or x=v or x=l or x=e then 1350
  110. 1330 if x=w(j) or x=t(j) or x=o(j) or x=n(j) or x=i(j) then 1350
  111. 1340 k=k+1:l(k)=l:v(k)=v:f(k)=f:s(k)=s:x(k)=x
  112. 1350 next:if c=0 then 1390
  113. 1360 gosub 2810:if j<=z then 1220
  114. 1370 if z=0 then 2200
  115. 1380 print d$d$:for i=1 to z:print".";:next:print h$d$d$d$d$d$d$d$d$:goto1600
  116. 1390 if k<j then 1460
  117. 1400 for i=j to k:x$=left$(str$(x(i)),3):if i<>j+19 then 1440
  118. 1410 print tab(20)m$,tab(21)"[205]ore <[195]> <[208]/[212]> <[209]>":gosub 5000
  119. 1420 gosub 2990:gosub 3020:gosub 3030:gosub 3040
  120. 1430 print tab(20)m$,tab(21)"[195]ontinued",tab(20)m$
  121. 1440 print tab(20)l(i)tab(24)v(i)tab(28)f(i)tab(32)s(i)tab(36)x$
  122. 1450 next
  123. 1460 gosub 2810:if z=0 then 2200
  124. 1470 gosub 2930:if j<=z then 1230
  125. 1480 :
  126. 1490 rem table 2 display
  127. 1500 for j=1 to z:if (j-1)/20>int((j-1)/20) then 1520
  128. 1510 gosub 2990:a=j
  129. 1520 gosub 3020:gosub 3130
  130. 1530 if j/20>int(j/20) and j<z then 1560
  131. 1540 b=j:print"-"m$m$,"[197]="e;l$":[212][193][194][204][197] 2:"a"-"b"/"z;tab(28)
  132. 1550 print r$"<[195]><[208]/[212]><[209]>"u$b$:gosub 5000
  133. 1560 next
  134. 1570 :
  135. 1590 rem table 3
  136. 1600 a=0:j=1:if c=0 then 1630
  137. 1610 print"[212][193][194][204][197] 3: "r$"[199]  [200]  [210]  [213]"b$
  138. 1620 print"[162]";:goto 1720
  139. 1630 gosub 2990:gosub 3020:gosub 3130:gosub 3030
  140. 1640 print" 3. [200]+[210] ="3-2*e-t(j):print" 4. [213]+[210] ="4-o(j)-f(j)
  141. 1650 pri